package util;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import org.biojava3.core.sequence.ProteinSequence;
import org.biojava3.core.sequence.io.FastaReaderHelper;


public class FastaReader {
	
	public static void main(String[] args) {
		String f = args[0];
		readFastaFile(f);
	}
	
	public static HashMap<String, String> readFastaFile(String file)
	{
		HashMap<String, String> result = new HashMap<String, String>();
		   // create a map of FASTA id and the sequence content
		   Map<String, ProteinSequence> map = null;
		try {
			map = FastaReaderHelper.readFastaProteinSequence(new File(file));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		   // DNA sequences can now be accessed from the map
		   for (String key : map.keySet())
		   {
		    String seq = map.get(key).getSequenceAsString();
		    result.put(key, seq);
		   }

		   return result;

	}

}
